package sdau.hjk.controller;

import sdau.hjk.entity.Manager;
import sdau.hjk.entity.User;
import sdau.hjk.entity.UserRecord;
import sdau.hjk.entity.UserReport;
import sdau.hjk.service.Impl.ManagerService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.List;

/**
 *@version 1.0
 *@author: huangjiakai
 *@create:2021−03-01 19:05
 *@className:com.hjk.controller.ManagerController
 *@description: TODO
 */
@Controller
@RequestMapping("/manager")
public class ManagerController {
    @Autowired
    private ManagerService managerService;

    @RequestMapping("/find")
    @ResponseBody
    public Manager find(String name, String password){
        Manager manager = managerService.find(name,password);
        return manager;
    }

    @RequestMapping("/findAllReport")
    @ResponseBody
    public List<UserReport> findReport(){
        return managerService.findAllReport();
    }

    @RequestMapping("/approveUserReport")
    public void approveUserReport(UserReport userReport){
        managerService.approveUserReport(userReport);
    }

    @RequestMapping("/findUserByMajor")
    @ResponseBody
    public List<User> findByMajor(String major){
        return managerService.findByMajor(major);
    }

    @RequestMapping("/findUserRecordNote")
    @ResponseBody
    public List<UserRecord> findByNote() throws Exception {
        return managerService.findByNote();
    }

    @RequestMapping("/findUserByNotClock")
    @ResponseBody
    public List<User> findUserByNotClock() throws Exception {
        return managerService.findByNotClock();
    }

    @RequestMapping("/deleteUser")
    public void deleteUser(Integer id){
        managerService.deleteUser(id);
    }

}
